package org.yoyo.server;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.yoyo.game.decoder.UserDecoderFactory;

public class MyServer {

	public static void main(String[] args) throws IOException{
		NioSocketAcceptor acceptor = new NioSocketAcceptor();
		acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new UserDecoderFactory ()));
		acceptor.getFilterChain().addLast("logger", new LoggingFilter());
		acceptor.setHandler(new MyServerHandlerAdapter());
		acceptor.bind(new InetSocketAddress(9998));
		System.out.println("socket server started,waitting for connection......"); 
	}
}
